BugĀ 601869 - GtkUIManager assumes too much about popup menus
authorMatthew Barnes <mbarnes@redhat.com>
Sun, 29 Nov 2009 01:00:07 +0000 (20:00 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Sun, 29 Nov 2009 01:00:07 +0000 (20:00 -0500)
Check that the child of a popup menu item is actually a GtkAccelLabel
before setting its "accel-closure" property.

gtk/gtkuimanager.c

index 771252d53c5d653fb377ae3d4045a0f3c8e62fe3..dff908550998b1776d6dbdd7a7449b99c1cb1f2c 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 
 #include <string.h>
+#include "gtkaccellabel.h"
 #include "gtkactivatable.h"
 #include "gtkbuildable.h"
 #include "gtkimagemenuitem.h"
@@ -2615,8 +2616,9 @@ update_node (GtkUIManager *self,
           if (in_popup && !popup_accels)
            {
              /* don't show accels in popups */
-             GtkWidget *label = GTK_BIN (info->proxy)->child;
-             g_object_set (label, "accel-closure", NULL, NULL);
+             GtkWidget *child = gtk_bin_get_child (GTK_BIN (info->proxy));
+             if (GTK_IS_ACCEL_LABEL (child))
+               g_object_set (child, "accel-closure", NULL, NULL);
            }
         }